package hk.com.fgoproduction.getdroplets.Lib.Common.AdaptiveStorage

object StorageApiWrapper {

    fun getRemovableExternalStorageDirectory(): String? {
        var temp = System.getenv("SECONDARY_STORAGE")

        if (temp === null || temp.length == 0) {
            temp = System.getenv("EXTERNAL_SDCARD_STORAGE")
        }

        val temp2 = GetSdcardList.externalMounts

        if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) {
            val path: String? = if (temp2.size == 0) null else temp2.first()
            if (path === null) return null

            val splitPath = path.split("/")

            return "/storage/" + splitPath[splitPath.size - 1]
        } else {
            return temp
        }
    }


}